﻿<%@ WebHandler Language="C#" Class="SIPO.Web.AjaxHandler.Loaddata.getrecSectorRegistration" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using SIPO.Library.DataAccess.Administration.Catalog;
using SIPO.Library.DomainObject.Administration.Catalog;
using SIPO.Library.Enum;
using SIPO.Web.Support;
using Newtonsoft.Json.Linq;
using SIPO.Library.DataAccess.Transaction;
using SIPO.Library.DomainObject.Transaction;
using System.Text;
namespace SIPO.Web.AjaxHandler.Loaddata
{
public class getrecSectorRegistration : SIPO.Web.BaseHandler
    {
        recSectorRegistrationRepo recSectorRegistrationDal = new recSectorRegistrationRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
        string MethodName = string.Empty;    
        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);
            if (context.Request.Params["method"] != null)
                MethodName = context.Request.Params["method"];
            if (MethodName == "GetByInvoiceNo")
            {
                string InvoiceNo = Convert.ToString(context.Request.Params["InvoiceNo"]);
                //List<recSectorRegistration> citys = recSectorRegistrationDal.GetList();
                //var result = citys.Where(x => x.InvoiceNo == InvoiceNo);
                recSectorRegistration obj = recSectorRegistrationDal.GetByInvoiceNo(InvoiceNo);
                StringBuilder sbProject = new StringBuilder();
                string RegistrationID = string.Empty;
                RegistrationID = obj == null ? "0" : obj.RegistrationID.ToString();
                sbProject.Append("{");
                sbProject.AppendFormat("  {0}RegistrationID{0}:{0}{1}{0}", "\"", RegistrationID);
                sbProject.Append("}");

                context.Response.Write(sbProject.ToString());
            }
        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}